import { post } from "@/utils/ajax";

// 查询能力清单
export function searchServiceList(query) {
  return post("/conn/service/searchServiceList", query);
}

// 转换配置 保存配置信息
export function savePzxxProtocol(query) {
  let url
  console.log(query.serverReleaseType);
  switch (query.serverReleaseType) {
    case '1':
      url =  '/conn/service/saveServiceApiDirect'
      break;
    case '2':
        url = '/conn/service/saveServiceOrchestration'
        break;
    case '3':
      url = '/conn/service/saveServiceProtocolConversion'
      break;
    case '4':
      url = '/conn/service/saveServiceDataSet'
      break;
    case '9':
      url = '/conn/service/saveServiceExpert'
      break;
    default:
      break;
  }
  return post(url, query);
}

// 升级版本保存配置调用接口
export function upgradePzxxProtocol(query) {
  let url
  switch (query.serverReleaseType) {
    case '1':
      url =  '/conn/service/upgradeApiDirectService'
      break;
    case '2':
        url = '/conn/service/upgradeOrchestrationService'
        break;
    case '3':
      url = '/conn/service/upgradeProtocolConversionService'
      break;
    case '4':
      url = '/conn/service/upgradeDataSetService'
      break;
    case '9':
      url = '/conn/service/upgradeExpertService'
    default:
      break;
  }
  return post(url, query);
}

// service输入参数表格
export function inputTableData(query) {
  return post("/conn/service/param/map/in/searchTree", query);
}

// service输出参数表格
export function outputTableData(query) {
  return post("/conn/service/param/map/out/searchTree", query);
}

// service输入参数表格
export function serviceInputData(query) {
  return post("/conn/service/param/in/searchTree", query);
}

// service输出参数表格
export function serviceOutputData(query) {
  return post("/conn/service/param/out/searchTree", query);
}

// 保存输入参数
export function saveSrcsProtocol(query) {
  return post("/conn/service/param/map/in/saveProtocol", query);
}

// 保存输出参数
export function saveSccsProtocol(query) {
  return post("/conn/service/param/map/out/saveProtocol", query);
}

// 获取测试/发布的数据
export function getCsfbData(query) {
  return post("/conn/service/selectServiceDetail", query);
}

// 测试接口
export function testApi(query) {
  return post("/conn/service/testApi", query);
}

// 提交审核
export function submitService(query) {
  return post("/conn/service/submitService", query);
}

// A03102_获取能力接口版本清单
export function searchVersion(query) {
  return post("/conn/service/version/search", query);
}

// 设置主版本
export function setMasterVersion(query) {
  return post("/conn/service/version/master", query);
}

// A03006_发布能力接口
export function publishService(query) {
  return post("/conn/service/publishService", query);
}

// A03005_删除能力
export function deleteService(query) {
  return post("/conn/service/deleteById", query);
}

// 删除能力对应版本
export function deleteServiceVersion(query) {
  return post("/conn/service/version/deleteByIdAndVersion", query);
}

// 撤销
export function revokeService(query) {
  return post("/conn/service/version/revoke", query);
}

// 作废
export function discardService(query) {
  return post("/conn/service/version/discard", query);
}

// A03304_刷新camle路由
export function reloadRouter(query, server_tag) {
  return post("/conn/service/version/reloadCamelRouter", query, { headers: { "Anvil-Server-Tag": server_tag } });
}

// 输入/输出参数 报存 序列化数据
export function updateRowNotNullById(query) {
  return post("/conn/service/typeprotocol/updateRowNotNullById", query);
}

// 输入、输出参数保存配置 （支持参数属性、结构转换）
export function updateVersionConfig (contentType) {
  return post('/conn/service/version/updateVersionConfig', contentType);
}

// 查询请求头参数
export function reqHeaderSearch (params) {
  return post('/conn/service/header/in/searchAll', params);
}
// 新增请求头参数
export function reqInParamInsert (params) {
  return post('/conn/service/header/in/insert', params);
}
// 修改请求头参数
export function reqInUpdateById (contentType) {
  return post('/conn/service/header/in/updateRowNotNullById', contentType);
}
// 删除请求头参数
export function reqInDeleteByIds (id) {
  return post('/conn/service/header/in/deleteById', { id });
}
// 保存请求头结构转换
export function saveChangeHeaderIn (params) {
  return post('/conn/change/header/in/saveChangeHeaderIn', params);
}

// 查询响应头参数
export function resHeaderSearch (params) {
  return post('/conn/service/header/out/searchAll', params);
}
// 新增响应头参数
export function resOutParamInsert (params) {
  return post('/conn/service/header/out/insert', params);
}
// 修改响应头参数
export function resOutUpdateById (contentType) {
  return post('/conn/service/header/out/updateRowNotNullById', contentType);
}
// 删除响应头参数
export function resOutDeleteByIds (id) {
  return post('/conn/service/header/out/deleteById', { id });
}
// 保存响应头结构转换
export function saveChangeHeaderOut (params) {
  return post('/conn/change/header/out/saveChangeHeaderOut', params);
}

// 批量新增输入参数
export function batchInParamInsert (params) {
  return post('/conn/service/param/in/batchImport', params);
}

// 新增输入参数
export function InParamInsert (params) {
  return post('/conn/service/param/in/insert', params);
}
// 修改输入参数
export function inUpdateById (contentType) {
  return post('/conn/service/param/in/updateRowNotNullById', contentType);
}
// 删除输入参数
export function inDeleteByIds (id) {
  return post('/conn/service/param/in/deleteById', { id });
}
// 保存输入参数结构转换
export function saveChangeParamIn (params) {
  return post('/conn/change/param/in/saveChangeParamIn', params);
}

// 批量新增输出参数
export function batchOutParamInsert (params) {
  return post('/conn/service/param/out/batchImport', params);
}
// 新增输出参数
export function InParamOutInsert (params) {
  return post('/conn/service/param/out/insert', params);
}
// 修改输出参数
export function outUpdateById (contentType) {
  return post('/conn/service/param/out/updateRowNotNullById', contentType);
}
// 删除输出参数
export function outDeleteByIds (id) {
  return post('/conn/service/param/out/deleteById', { id });
}
// 保存输出参数结构转换
export function saveChangeParamOut (params) {
  return post('/conn/change/param/out/saveChangeParamOut', params);
}

// 根据ID获取父节点详情
export function selectparentDetail (id) {
  return post('/conn/service/param/in/selectById', { id });
}
// 保存能力编排数据
export function saveNLBP (params) {
  return post('/conn/service/saveOrchestrationDsl', params);
}
// 保存能力编排数据
export function saveExpertDsl (params) {
  return post('/conn/service/saveExpertDsl', params);
}
// 查询能力编排数据
export function getNLBP (params) {
  return post('/conn/service/getOrchestrationDsl', params);
}
// 查询能力编排
export function getExpertDsl (params) {
  return post('/conn/service/getExpertDsl', params);
}


// 查询api请求头
export function searchChangeHeaderIn (params) {
  return post('/conn/change/header/in/searchChangeHeaderIn', params);
}
// 查询服务响应头
export function searchChangeHeaderOut (params) {
  return post('/conn/change/header/out/searchChangeHeaderOut', params);
}
// 查询输入参数
export function searchChangeParamInTree (params) {
  return post('/conn/change/param/in/searchChangeParamInTree', params);
}
// 查询输出参数
export function searchChangeParamOut (params) {
  return post('/conn/change/param/out/searchChangeParamOut', params);
}
// 复制能力
export function copyService (params) {
  return post('/conn/service/copyService', params);
}

// 查询能力清单
export function searchUnloadedServiceList(query) {
  return post("/conn/service/searchUnloadedServiceList", query);
}
